home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / examples / doc / cntour03 < prev    next >
Text File  |  1997-07-08  |  2KB  |  71 lines

  1. ; This batch file creates a PostScript file of a contour plot
  2. ; overlaid with an image. This example is from Chapter 11,
  3. ; "Plotting Multi-dimensional Arrays", of _Using IDL_.
  4.  
  5. ; Restore variables elev, X, and Y.
  6.  
  7. @cntour01
  8.  
  9. ; Set missing data points to a large value.
  10.  
  11. elev(WHERE(elev EQ 0)) = 1E6    
  12.  
  13. ; REBIN down to a 72 x 92 matrix.
  14.  
  15. new = REBIN(elev, 360/5, 460/5)    
  16.  
  17. ; Store the current graphics device.
  18.  
  19. old_dev=!D.NAME
  20.  
  21. ; Set the current graphics device to PostScript.
  22.  
  23. SET_PLOT, 'ps'
  24.  
  25. ; Use hardware fonts.
  26.  
  27. !P.FONT=0
  28.  
  29. ; Open a file in the current directory to contain the PostScript plot.
  30.  
  31. DEVICE, file='marbells.ps', /ENCAP
  32.  
  33. ; Scale the range of valid elevations into intensities.
  34.  
  35. image = BYTSCL(elev, MIN=2658, MAX=4241)    
  36.  
  37. ; Before displaying the image, use the CONTOUR command to create
  38. ; the appropriate plot window. The plot window must be created
  39. ; before re-sizing the image data. Use the NODATA keyword to inhibit
  40. ; actually drawing the contour plot.
  41.  
  42. CONTOUR, new, X, Y, LEVELS = 2750 + FINDGEN(6) * 250., $
  43.      MAX_VALUE = 5000, XSTYLE = 1, YSTYLE = 1, TITLE='Maroon Bells Region', $
  44.      SUBTITLE = '250 meter contours', XTITLE = 'UTM Coordinates (KM)', /NODATA
  45.  
  46. ; Display the image with its lower-left corner at the origin of the plot 
  47. ; window and with its size scaled to fit the plot window.
  48.  
  49. TVSCL, image, !X.WINDOW(0), !Y.WINDOW(0), $
  50.     XSIZE = !X.WINDOW(1) - !X.WINDOW(0), $
  51.     YSIZE = !Y.WINDOW(1) - !Y.WINDOW(0), /NORM
  52.  
  53. ; Write the contours over the image, being sure to use the exact axis 
  54. ; styles so that the contours fill the plot window. Inhibit erasing.
  55.  
  56. CONTOUR, new, X, Y, LEVELS = 2750 + FINDGEN(6) * 250., $
  57.      MAX_VALUE = 5000, XSTYLE = 1, YSTYLE = 1, TITLE='Maroon Bells Region', $
  58.      SUBTITLE = '250 meter contours', XTITLE = 'UTM Coordinates (KM)', /NOERASE
  59.  
  60. ; Close the PostScript file.
  61.  
  62. DEVICE, /CLOSE
  63.  
  64. ; Use vector fonts.
  65.  
  66. !P.FONT=1
  67.  
  68. ; Set the current graphics device back to its original setting.
  69.  
  70. SET_PLOT, old_dev
  71.